﻿<Window 
    x:Class="Microsoft.Samples.Office.UnifiedCommunications.Gadget.PresenceHistory"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Microsoft.Samples.Office.UnifiedCommunications.Gadget"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="Presence History"
    Height="545" 
    Width="350"
    Style="{StaticResource PresenceHistoryChromelessWindowTemplate}"
    WindowStyle="None"
    AllowsTransparency="True"
    Loaded="Window_Loaded" 
    ResizeMode="NoResize"
    SnapsToDevicePixels="True">

    <Window.Resources>
        <Storyboard x:Key="LoadAni">
            <local:BackDoubleAnimation Completed="BackDoubleAnimation_Completed" From="300" To="0" Duration="0:0:0.8" EdgeBehavior="EaseOut" Amplitude=".5"   Suppression="0" DecelerationRatio=".5" Storyboard.TargetName="mainGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"/>
        </Storyboard>
        <local:StatusTexttoImageConverter x:Key="statusTexttoImageConverter"/>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource LoadAni}"/>
        </EventTrigger>
    </Window.Triggers>
    
    <Border Width="Auto" Height="Auto" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="1,1,1,1">
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
            <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="0,12,0,0" x:Name="NameGrid">
                <TextBlock Text="{Binding Path=Text, ElementName=txtName, Mode=Default}" TextWrapping="Wrap" Foreground="#FF181C24" 
                           FontFamily="Arial" FontSize="15" Margin="-.5,-1,0,0"/>
                <TextBlock TextWrapping="Wrap" Foreground="#FFFFFFFF" FontFamily="Arial" FontSize="15" x:Name="txtName"/>
        	</Grid>

            <Grid x:Name="mainGrid" HorizontalAlignment="Stretch" Height="Auto" VerticalAlignment="Stretch" Width="Auto" Margin="10,45,10,10" >
                <Grid.RenderTransform>
                    <TranslateTransform X="0" Y="0"/>
                </Grid.RenderTransform>
                <Border BorderThickness="1,1,1,1" BorderBrush="#FF333945" CornerRadius="9,9,9,9">
                    <Border Width="Auto" Height="Auto" BorderBrush="#FF161D25" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8">
                        <Grid Width="Auto" Height="Auto" x:Name="ContentGrid">
                            <Rectangle Stroke="{x:Null}" RadiusX="8" RadiusY="8" Width="Auto" Height="Auto" MinHeight="380" MinWidth="280">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFDAE3EF" Offset="0"/>
                                        <GradientStop Color="#FFE2EBF1" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <TextBlock VerticalAlignment="Top" Text="Presence History" TextWrapping="Wrap" FontFamily="Calibri" FontSize="16" 
                                       FontWeight="Bold" Foreground="#FF3D4F73" d:LayoutOverrides="Width" HorizontalAlignment="Center" Margin="0,5,0,0"/>
                    
                            <Grid x:Name="gridContent" Visibility="Visible" Margin="0,30,0,0">
                		        <DockPanel VerticalAlignment="Stretch" Height="Auto">
                                    <TextBlock x:Name="tbRefresh" Width="50" Height="20" DockPanel.Dock="Bottom"
                                               HorizontalAlignment="Center" VerticalAlignment="Center" Text="Refresh" Cursor="Hand"
                                               TextWrapping="Wrap" FontFamily="Calibri" FontSize="14" FontWeight="Bold" Foreground="#FF3D4F73" 
                                               MouseDown="tbRefresh_MouseDown"/>
                                    
                                    <Grid Width="Auto" Height="Auto">
                                        <ScrollViewer x:Name="myScrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" 
                                                      HorizontalAlignment="Stretch"  Background="#FFFFFFFF" FontFamily="Arial" FontSize="14" 
                                                      Foreground="#FF000000" BorderBrush="{x:Null}" BorderThickness="0,0,0,0" Margin="0,0,0,0" Width="Auto">
                                            <ListBox x:Name="listBoxPresenceEvents" BorderThickness="0px" HorizontalContentAlignment="Stretch" 
                                                     VerticalContentAlignment="Stretch" Width="Auto" Height="Auto" >
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
	                                                    <Border BorderBrush="#dcdcdc" BorderThickness="0 0 0 1">
		                                                    <Grid>
			                                                    <Grid.ColumnDefinitions>
				                                                    <ColumnDefinition Width="50"/>
                                                                    <ColumnDefinition Width="130"/>
                                                                    <ColumnDefinition Width="140"/>
			                                                    </Grid.ColumnDefinitions>
                                                          
                                                                <Image Grid.Column="0" x:Name="imgGumdrop" VerticalAlignment="Center" HorizontalAlignment="Center" Height="22" Width="22"
                                                                       Source="{Binding Path=StatusText, Converter={StaticResource statusTexttoImageConverter}, Mode=Default}"/>
                                                                <Label Grid.Column="1" Content="{Binding Path=PresenceEventDateTime}" FontSize="14" FontFamily="Calibri" 
                                                                       FontWeight="Bold" HorizontalAlignment="Left" />
			                                                    <Label Grid.Column="2" Content="{Binding Path=StatusText}" FontSize="14" FontFamily="Calibri" FontWeight="Bold" 
                                                                       HorizontalAlignment="Left" Margin="0,0,15,0"/>
		                                                    </Grid>
	                                                    </Border>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </ScrollViewer>
                                        <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto" Height="2" Fill="{DynamicResource dropShadow}" StrokeThickness="0" />
                                        <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Width="Auto" Height="2" Fill="{DynamicResource dropShadowReverse}" StrokeThickness="0" RenderTransformOrigin="0.5,0.5" >
                                            <Rectangle.RenderTransform>
                                                <TransformGroup>
	                                                <ScaleTransform ScaleX="1" ScaleY="1"/>
	                                                <SkewTransform AngleX="0" AngleY="0"/>
	                                                <RotateTransform Angle="180"/>
	                                                <TranslateTransform X="0" Y="0"/>
                                                </TransformGroup>
                                            </Rectangle.RenderTransform>
                                        </Rectangle>                        
                			        </Grid>                        
                		        </DockPanel>
                            </Grid>
    			        </Grid>
                    </Border>
                </Border>
            </Grid>            
        </Grid>
    </Border>
</Window>
